package com.ruoyi.business.controller.unit;

import com.ruoyi.base.controller.BaseController;
import com.ruoyi.base.enums.unit.UnitEnum;
import com.ruoyi.base.pojo.HttpResult;
import com.ruoyi.business.pojo.unit.UnitDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 单位
 * @author Administrator
 */
@Api(tags = "单位")
@RestController
@RequestMapping("/unit")
public class UnitController extends BaseController {
    /**
     * 获取单位列表
     */
    @ApiOperation("获取单位列表")
    @GetMapping("/list")
    public HttpResult<List<UnitDTO>> getList() {
        return data(Arrays.stream(UnitEnum.values()).map(UnitDTO::new).collect(Collectors.toList()));
    }
}
